/*
 * Copyright (c) 2006-2020, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2020-05-21     chenhy       the first version
 */
#ifndef APPLICATIONS_I2C_H_
#define APPLICATIONS_I2C_H_
#include <stdint.h>

typedef struct bus_io_s {
  uint32_t scl_port;
  uint32_t scl_pin;
  uint32_t sda_port;
  uint32_t sda_pin;
} bus_io_t;
extern bus_io_t i2c1, i2c2;
int32_t i2c_write(bus_io_t* bus, uint8_t address, uint16_t reg, void* pbuf, int32_t size, uint8_t reg_16bit);
int32_t i2c_read(bus_io_t* bus, uint8_t address, uint16_t reg, void* pbuf, int32_t size, uint8_t reg_16bit);
int32_t i2c_bytes_write(bus_io_t* bus, uint8_t address, void* pbuf, int32_t size);
int32_t i2c_bytes_read(bus_io_t* bus, uint8_t address, void* pbuf, int32_t size);
void i2c_delay_ms(int32_t value);
#endif /* APPLICATIONS_I2C_H_ */
